<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Object 中的三个常用方法</title>
</head>
<body>
    <script>
        const obj = {
            age:10,
            hasOwnProperty:_=> false
        }
        console.log(obj.hasOwnProperty())
        console.log(Object.hasOwnProperty.call(obj,'age'))

        // 构造函数
        function Person(name,sex) {
            this.name = name
            this.sex = sex
        }
        // 原型上添加属性和方法
        Person.prototype.height = '173'
        Person.prototype.eat = function() {
            console.log('prototype eat function console')
        }
        // 构造函数
        function Student(age) {
            this.age = age
        }
        // 继承Person
        Student.prototype = new Person('小明')
        Student.prototype.constructor = Student
        const stu = new Student(16)
        console.log(stu.hasOwnProperty('age'))
        // console.log(Student.prototype)


        // Object.prototype.propertyIsEnumerable()   // 2
        // Object.prototype.isPrototypeOf() // 3
    </script>
</body>
</html>